Martin

996 minute read

library(tidyverse)
## ── Attaching packages ────────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✓ ggplot2 3.1.0       ✓ purrr   0.3.2  
## ✓ tibble  2.1.1       ✓ dplyr   0.8.0.1
## ✓ tidyr   0.8.3       ✓ stringr 1.4.0  
## ✓ readr   1.3.1       ✓ forcats 0.4.0
## ── Conflicts ───────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(plotly)
## 
## Attache Paket: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(slickR)
# l <- leaflet() %>% addTiles()
# htmlwidgets::saveWidget(l,'leaflet.html')

pa <- iris%>%ggplot(aes(x=Petal.Length,y=Petal.Width))+geom_point()
p <- iris%>%ggplot(aes(x=Sepal.Length,y=Sepal.Width))+geom_point()
pL= ggplotly(p)
ppL= ggplotly(pa)
htmlwidgets::saveWidget(pL,'ggplotly1.html')
htmlwidgets::saveWidget(ppL,'ggplotly2.html')

slickR(c(rep(paste0(readLines('ggplotly1.html'),collapse='\n'),4),
         rep(paste0(readLines('ggplotly2.html'),collapse='\n'),4)),
       slideId = c('leaf','plot'),
       slideIdx = list(1:4,5:8),
       slideType = rep('iframe',2),
       slickOpts = list(list(dots=T,slidesToShow=2,slidesToScroll=2),
                        list(dots=T,slidesToShow=2,slidesToScroll=2)),
       height='200px',width='100%')
## Warning: The `slickOpts` argument of `slickR()` is deprecated as of slickR 0.5.0.
## This warning is displayed once per session.
## Call `lifecycle::last_warnings()` to see where this warning was generated.